package com.etlmaster.transformer.funcs;

import java.util.Map;

import com.etlmaster.executor.annotation.StepInstruction;
import com.etlmaster.executor.trans.core.Line;
import com.etlmaster.executor.trans.core.LineTransProcessor;

/**
 * 身份证15位转18位
 * @author Wugf
 * @date 2017-03-08
 */
@StepInstruction("transIdCard")
public class TransIdCard extends LineTransProcessor{

	
	public TransIdCard(String sourceTab,String sourceCol,String targetTab,String targetCol,String changeCode,Map paramStr,Map var){
		
		super( sourceTab,sourceCol,targetTab,targetCol,changeCode, paramStr,var);
	
	}

	@Override
	public void transField(Line line) {
		try {
			line.replaceField(IdCardHelperUtil.getInstance().getEighteenIDCard(line.getField(getFieldIndex(line))), getFieldIndex(line));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			line.setSkip(true);
		}
	}
	
}
